﻿<UserControl xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:t="clr-namespace:MobishopManagement.Model"
             x:Class="MobishopManagement.View.UserControl.AccountUC"
             mc:Ignorable="d" 
             d:DesignHeight="500" d:DesignWidth="1000">
    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*"/>
            <ColumnDefinition Width="2*"/>
        </Grid.ColumnDefinitions>

        <!--Infomation details-->
        <StackPanel Grid.Column="0">
            <StackPanel Orientation="Horizontal" Margin="5" HorizontalAlignment="Left">
                <TextBlock Text="Username:" Width="100" TextAlignment="Right" Margin="5" VerticalAlignment="Center"/>
                <TextBox Text="{Binding AccountObj.AccUsername, Mode=TwoWay}" Width="150"  Margin="5"/>
            </StackPanel>
            <StackPanel Orientation="Horizontal" Margin="5" HorizontalAlignment="Left">
                <TextBlock Text="Password:" Width="100" TextAlignment="Right" Margin="5" VerticalAlignment="Center"/>
                <TextBox Text="{Binding AccountObj.AccPassword, Mode=TwoWay}" Width="150" Margin="5"/>
            </StackPanel>
            <StackPanel Orientation="Horizontal" Margin="5" HorizontalAlignment="Left">
                <TextBlock Text="Type:" Width="100" TextAlignment="Right" Margin="5" VerticalAlignment="Center"/>
                <ComboBox Width="150"  Margin="5" SelectedValuePath="Content" SelectedValue="{Binding AccountObj.AccType, Mode=TwoWay}">
                    <ComboBoxItem Content="user"/>
                    <ComboBoxItem Content="admin"/>
                </ComboBox>
            </StackPanel>
            <Grid HorizontalAlignment="Center">
                <StackPanel Orientation="Horizontal" Margin="5" HorizontalAlignment="Left">
                    <Button Width="80" Content="Add" Margin="5" Command="{Binding AddCommand}"/>
                    <Button Width="80" Content="Update" Margin="5" Command="{Binding UpdateCommand}"/>
                    <Button Width="80" Content="Delete" Margin="5" Command="{Binding DeleteCommand}"/>
                </StackPanel>
            </Grid>
            <Grid HorizontalAlignment="Center" Margin="5">
                <TextBlock Text="{Binding Status}"/>
            </Grid>
        </StackPanel>
        <Grid Grid.Column="1">
            <DataGrid ItemsSource="{Binding DataAccounts}" Margin="5" IsReadOnly="True" AutoGenerateColumns="False" SelectedItem="{Binding AccountObj}" >
                <DataGrid.Columns>
                    <DataGridTextColumn Binding="{Binding AccID}" Header="ID" />
                    <DataGridTextColumn Binding="{Binding AccUsername}" ClipboardContentBinding="{x:Null}" Header="Username"/>
                    <DataGridTextColumn Binding="{Binding AccPassword}" ClipboardContentBinding="{x:Null}" Header="Password"/>
                    <DataGridTextColumn Binding="{Binding AccType}" ClipboardContentBinding="{x:Null}" Header="Type"/>
                </DataGrid.Columns>
            </DataGrid>
        </Grid>
    </Grid>
</UserControl>
